<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>客户订单管理</title>
    <c:import url="../../header.jsp"/>
    <style>
        table.crm-table.cell-border tbody td{
            white-space: nowrap;
        }
    </style>
</head>
<body>
<div class="body-main">
<form action="" id="customerScOrderTableObj">
   <div class="titleSearch">
            <div class="layui-inline">
                <label>客户电话：</label>
                <div class="layui-input-inline">
                    <input name="customerPhone" type="text" class="input-style" maxlength="50"
                           placeholder="请输入客户电话">
                </div>
            </div>
           <div class="layui-inline">
               <label>客户名称：</label>
               <div class="layui-input-inline">
                   <input name="customerName" type="text" class="input-style" maxlength="50"
                          placeholder="请输入客户名称">
               </div>
           </div>
           <div class="layui-inline">
               <label>企业名称：</label>
               <div class="layui-input-inline">
                   <input name="companyName" type="text" class="input-style" maxlength="50"
                          placeholder="请输入企业名称">
               </div>
           </div>
             <div class="layui-inline">
                <button class="layui-btn layui-btn-mini layui-btn-normal" type="button" onclick="customerScOrderDataTableReload()">搜索</button>
                <button class="layui-btn layui-btn-mini layui-btn-primary" type="button" onclick="cleanSearch()">清空</button>
                <d:hasUrlAuth authCode="ZZSC_AllSCORDER_EXPORT">
                <button class="layui-btn layui-btn-mini layui-btn-green" type="button" onclick="export_data()">导出</button>
                </d:hasUrlAuth>
            </div>
        </div>
        </form>
    <div class="table-body">
        <!--表格 start-->
        <table id="allScOrderTable" class="cell-border crm-table columnsHidden dataTable">
            <thead>
            <tr>
                <th width="20"><input type="checkbox" class="checkall"/></th>
                <th width="50">序号</th>
                <th>客户编号</th>
                <th>客户名称</th>
                <th>企业名称</th>
                <th>客户电话</th>
                <th>订单总金额</th>
                <th>订单总量</th>
                <th>办理中</th>
                <th>已暂停</th>
                <th>已中止</th>
                <th>退单待审核</th>
                <th>退单驳回</th>
                <th>已退单</th>
                <th>生产完结</th>
                <th>已结项</th>
                <th>办理中节点超期单数</th>
                <th>订单超期单数</th>
                <th>合同超期单数</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>

            </tbody>
        </table>
        <!--表格 end-->
    </div>
</div>
<c:import url="/WEB-INF/jsp/footer.jsp"/>
<script type="text/javascript"
        src="${basePath}/static/js/choose.extend.js?v=${version}"></script>
<script type="text/javascript" src="${basePath}/static/js/zzsc/production/sc_common.js?v=${version}"></script>
<script type="text/javascript" src="${basePath}/static/js/zzsc/common/call_common.js?v=${version}"></script>
<script type="text/javascript" src="${basePath}/static/js/zzsc/inprocess/inprocess_list.js?v=${version}"></script>
<script src="${rootUrl}/static/js/zzsc/common/sc_chooseUser.js?v=${version}" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">

    $(function () {
        var customerScOrderTableObj;
    });

    //列表刷新
    function customerScOrderDataTableReload() {
        customerScOrderTableObj.ajax.reload();
    }

    function export_data() {
        var paras = $('#customerScOrderTableObj').serialize2object();
        if (Object.keys(paras).length == 0) {
            DGG.Warning('请加入搜索条件后导出！');
            return;
        }
        export_table('/sc/all/customerExport.do', $("#customerScOrderTableObj").serializeObject());
    }

    // 获取搜索数据
    function getSearchData() {
        return $("#customerScOrderTableObj").serializeObject();
    }

    $(document).ready(function () {
        //初始化dataTable列表
        //初始化dataTable列表
        customerScOrderTableObj = $('#allScOrderTable').dataTableExtend({
            "ajax": {"url": "${basePath}/sc/all/customerScOrderJson.do", "type": "post"},
            "fnServerParams": function (aoData) {
                aoData = $.extend(aoData, $("#customerScOrderTableObj").serializeObject());
                return aoData;
            },
            "scrollX": "true",//是否开启横项滚动
            "fixedColumns": {//锁定列，只有开启scrollX时才生效
                "leftColumns": 4,//左侧锁定2列
                "rightColumns": 1//右侧锁定1列
            },
            "aoColumns": [
                {//多选框
                    "orderable": false,
                    "data": "id",
                    "render": function (data, type, full, meta) {
                        return '<input type="checkbox"  name="ids" class="checkchild"  value="' + data + '" />';
                    }
                }
                , {//序号
                    "orderable": false,
                    "render": function (data, type, full, meta) {
                        return meta.row + 1;
                    }
                },  {//客户编号
                    "orderable": false,
                    "data": "customerNo"
                }, {//客户名称
                    "orderable": false,
                    "data": "customerName",
                    "render": function (data, type, full, meta) {
                        return data ? data : '';
                    }
                }, {//企业名称
                    "orderable": false,
                    "data": "companyName",
                    "render": function (data, type, full, meta) {
                        if(data) {
                            var htm = '<p class="line2 remarkAlertClass" style="min-width: 100px" title="' + data + '">' + data + '</p>';
                            return htm;
                        }else{
                            return '';
                        }
                    }
                },
                {//客户电话
                    "orderable": false,
                    "data": "customerPhone",
                    "render": function (data, type, full, meta) {
                        return data ? data : '';
                    }
                },
                {//订单总金额
                    "orderable": false,
                    "data": "money",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },
                {//订单总量
                    "orderable": false,
                    "data": "totleNum",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },
                {//办理中
                    "orderable": false,
                    "data": "inprocessCount",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{//已暂停
                    "orderable": false,
                    "data": "suspendCount",
                    "render": function (data, type, full, meta) {
                        return data ? data :0;
                    }
                },{//已中止
                    "orderable": false,
                    "data": "orderStopCount",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{//退单待审核
                    "orderable": false,
                    "data": "chargeBackingCount",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{//退单驳回
                    "orderable": false,
                    "data": "chargeBackBhCount",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{//已退单
                    "orderable": false,
                    "data": "chargeBackedCount",
                    "render": function (data, type, full, meta) {
                        return data ? data :0;
                    }
                },{//已生产完结
                    "orderable": false,
                    "data": "orderOverCount",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{//已结项
                    "orderable": false,
                    "data": "orderJuncttonCount",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{ //节点超期
                    "orderable": false,
                    "data": "nodeStatus",
                    "render": function (data, type, full, meta) {
                        return data ? data : 0;
                    }
                },{//订单超期
                    "orderable": false,
                    "data": "orderStatus",
                    "render": function (data, type, full, meta) {
                        return data ? data :0;
                    }
                },{//合同超期
                    "orderable": false,
                    "data": "contractStatus",
                    "render": function (data, type, full, meta) {
                        return data ? data :0;
                    }
                },
                 {
                    "orderable": false,
                    "data": "status",
                    "render": function (data, type, full, meta) {
                        var result = "";
                        result += '<a href=\'javascript:void(0)\' class="layui-table-link" onclick="findCustomerInfo(\'' + full.customerNo + '\',\''+full.customerId+'\')" /><span style="color: #0066ff ">查看详情</a>&nbsp;';
                        return result;
                    }
                }]
        });
    });

    function findCustomerInfo(customerNo,customerId) {
        window.parent.addTab('客户订单详情:' + customerNo,sysInfo.basePath +"/sc/all/findCustomerInfo.html?customerNo=" + customerNo+"&customerId="+customerId);
    }
</script>

</body>

</html>